using vue0701.Application.Common.interfaces;
using BCrypt.Net;
namespace vue0701.Infrastructure.Security;

public class PasswordHasher : IPasswordHasher
{
    public string GenerateSalt()
    {
        return Guid.NewGuid().ToString("N");
    }

    public string HashPassword(string password, string salt)
    {
        return BCrypt.Net.BCrypt.HashPassword(password + salt);
    }

    public bool VerifyHashedPassword(string hashedPassword, string salt, string providedPassword)
    {
        return BCrypt.Net.BCrypt.Verify(providedPassword + salt, hashedPassword);
    }
}